#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <omp.h>

#define ceild(n,d)  ceil(((double)(n))/((double)(d)))
#define max(x,y)    ((x) > (y)? (x) : (y))
#define min(x,y)    ((x) < (y)? (x) : (y))
#define myabs(x,y)  (((x) > (y))? ((x)-(y)) : ((y)-(x)))



          
#define  kernel_t(A,t) A[(t+1)%2][x][y][z] = 2.666f * A[(t)%2][x][y][z] - \
		0.166f * (A[(t)%2][x-1][y][z] + A[(t)%2][x+1][y][z] + A[(t)%2][x][y-1][z] + A[(t)%2][x][y+1][z] + A[(t)%2][x][y][z+1] + A[(t)%2][x][y][z-1]) - \
		0.0833f * (A[(t)%2][x-1][y-1][z] + A[(t)%2][x+1][y-1][z] + A[(t)%2][x-1][y+1][z] + A[(t)%2][x+1][y+1][z] + \
			   A[(t)%2][x-1][y][z-1] + A[(t)%2][x+1][y][z-1] + A[(t)%2][x][y-1][z-1] + A[(t)%2][x][y+1][z-1] + \
			   A[(t)%2][x-1][y][z+1] + A[(t)%2][x+1][y][z+1] + A[(t)%2][x][y-1][z+1] + A[(t)%2][x][y+1][z+1])

#define  kernel(A) kernel_t(A, t)


					 

#define  kernel_xxyy(A,t) A[(t+1)%2][x+xx][y+yy][z] = 2.666f * A[(t)%2][x+xx][y+yy][z] - \
		0.166f * (A[(t)%2][x+xx-1][y+yy][z] + A[(t)%2][x+xx+1][y+yy][z] + A[(t)%2][x+xx][y+yy-1][z] + A[(t)%2][x+xx][y+yy+1][z] + A[(t)%2][x+xx][y+yy][z+1] + A[(t)%2][x+xx][y+yy][z-1]) - \
		0.0833f * (A[(t)%2][x+xx-1][y+yy-1][z] + A[(t)%2][x+xx+1][y+yy-1][z] + A[(t)%2][x+xx-1][y+yy+1][z] + A[(t)%2][x+xx+1][y+yy+1][z] + \
			   A[(t)%2][x+xx-1][y+yy][z-1] + A[(t)%2][x+xx+1][y+yy][z-1] + A[(t)%2][x+xx][y+yy-1][z-1] + A[(t)%2][x+xx][y+yy+1][z-1] + \
			   A[(t)%2][x+xx-1][y+yy][z+1] + A[(t)%2][x+xx+1][y+yy][z+1] + A[(t)%2][x+xx][y+yy-1][z+1] + A[(t)%2][x+xx][y+yy+1][z+1])

#define XSLOPE 1
#define YSLOPE 1
#define ZSLOPE 1
#define XSTART 4
#define YSTART 4
#define ZSTART 4
#define DATA_TYPE double

